cmake_minimum_required(VERSION 3.15)
project(10_fixed_functions C CXX)

set(CMAKE_CXX_STANDARD 17)

find_package(Vulkan REQUIRED)
include_directories(${Vulkan_INCLUDE_DIRS})

add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} ${Vulkan_LIBRARIES})

add_custom_target(SHADER_SPIV ALL
    COMMAND ${Vulkan_GLSLC_EXECUTABLE} shader.vert -o vert.spv
    COMMAND ${Vulkan_GLSLC_EXECUTABLE} shader.frag -o frag.spv
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/shader)
add_dependencies(${PROJECT_NAME} SHADER_SPIV)

add_definitions(-DSHADER_DIR="${CMAKE_CURRENT_SOURCE_DIR}/shader")

if(MSVC)
    include(../cmake/Find3rdLibs.cmake)
    target_link_libraries(${PROJECT_NAME} GL::GLLIBS)
	
	set(RUNPATH "${PROJECT_SOURCE_DIR}/../prebuilts/dll")
	set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${RUNPATH})
	set_property(DIRECTORY "${PROJECT_SOURCE_DIR}" PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
else(MSVC)
    find_package(glfw3 CONFIG REQUIRED)
    target_link_libraries(${PROJECT_NAME} glfw)
endif(MSVC)

